

//设置html根目录字体大小
require(['jquery','../modules/pageSize'],function($,pageSetSize){
	setRootFontSize(pageSetSize);
})

//优惠套餐效果
require(['jquery','../modules/popup'],function($,pop){
    // 弹窗
    var that;
    var boolean;
    /*$('.norms').each(function(){
        $(this).click(function(){
            that = $(this);
            pop.popupSlide('.discountPackage-popup');
        })
        $('.discountPackage-popup .cart-sure').click(function(){
           $('.discountPackage-popup li').each(function(){
                if($(this).hasClass('active')){
                    var currItemValue = $(this).find('p:first-child').text();
                    that.find('span').text(currItemValue);
                }
           })
        })
    })*/
    //规格选择切换
    $('.discountPackage-popup li').each(function(){
        $(this).bind('click',function(){
            if($(this).hasClass('out-stock')){
                return ;
            }
            else{
                $(this).addClass('active').siblings().removeClass('active');
            }
        })     
    })
    //加入购物车按钮
    $('.package-item').each(function(){
        var here = $(this);
        $(this).find('.package-item-cart a').click(function(){
            $.ajax({
                dataType:'json',
                type:'post',
                url:'/Home/goods/addGroupCart'+getFixedExtraUrl(),
                data:{'group_id':$(this).data('id'),'local_id':$(this).data('lid')},
                success:function (data) {
                    if(data.status ==1){
                        pop.alertPopup(data.msg);
                        setTimeout(function () {
                            window.location.href=data.url;
                        },1500);

                    }else{
                        pop.alertPopup(data.msg);
                    }

                },
                error:function () {
                    pop.alertPopup("参数错误！");
                }

            })


           /* if(boolean=='true'){
                pop.alertPopup('加入购物车成功');
            }*/
        })
    })    
})


